const { Sequelize } = require('sequelize');

// 初始化 Sequelize
const sequelize = new Sequelize('shujuguanli', 'root', '123456', {
  host: '192.168.0.167', // 数据库地址
  port: 5432,
  dialect: 'postgres', // 使用 PostgreSQL
  logging: false, // 关闭日志（可选）
});

(async () => {
  try {
    await sequelize.authenticate();
    console.log('Database connected successfully.');
  } catch (error) {
    console.error('Unable to connect to the database:', error);
  }
})();

module.exports = sequelize;